<template>
  <el-row>
    <!-- 一行24个槽，每个分12个，也就是50% 50%   -->
    <el-col :span="8">
    <!-- 左侧内容     -->
      <el-card class="box-card">
          <div class="user">
            <img class="img" src="../assets/images/user.png">
            <div class="user-info">
              <p class="name">Admin</p>
              <p class="access">超级管理员</p>
            </div>
          </div>
          <div class="login-info">
              <p>上次登录时间：<span>2022-10</span></p>
              <p>上次登录地点：<span>江苏省·南京市</span></p>
          </div>
      </el-card>
      <el-card style="margin-top:20px;height: 460px;">
        <el-table :data="tableData" style="width: 100%">
<!--          <el-table-column
              prop="name"
              label="课程">
          </el-table-column>
          <el-table-column
              prop="todayBuy"
              label="今日购买">
          </el-table-column>
          <el-table-column
              prop="monthBuy"
              label="本月购买">
          </el-table-column>
          <el-table-column
              prop="totalBuy"
              label="总购买">
          </el-table-column>-->
          <el-table-column v-for="(val,key) in tableLabel" :prop="key" :label="val"/>

        </el-table>
      </el-card>
    </el-col>
    <!-- 右侧内容   -->
    <el-col :span="16">
        <div class="num">
            <el-card v-for="item in countData" :key="item.name" :body-style="{display:'flex',padding:0}">
              <i class="icon" :class="`el-icon-${item.icon}`" :style="{background:item.color}"/>
              <div class="detail">
                <p class="price" >￥{{item.value}}</p>
                <p class="dec">{{item.name}}</p>
              </div>
            </el-card>
        </div>
    </el-col>
  </el-row>
</template>
<script>
import {getData} from '../api'

export default {
  data(){
    return {
      tableData:[
        {
          name: 'oppo',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        },
        {
          name: 'vivo',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        },
        {
          name: '苹果',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        },
        {
          name: '小米',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        },
        {
          name: '三星',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        },
        {
          name: '魅族',
          todayBuy: 100,
          monthBuy: 300,
          totalBuy: 800
        }
      ],
      tableLabel:{
        name:'课程',
        todayBuy:'今日购买',
        monthBuy:'本月购买',
        totalBuy:'总购买'
      },
      countData: [
        {
          name: "今日支付订单",
          value: 1234,
          icon: "success",
          color: "#2ec7c9",
        },
        {
          name: "今日收藏订单",
          value: 210,
          icon: "star-on",
          color: "#ffb980",
        },
        {
          name: "今日未支付订单",
          value: 1234,
          icon: "s-goods",
          color: "#5ab1ef",
        },
        {
          name: "本月支付订单",
          value: 1234,
          icon: "success",
          color: "#2ec7c9",
        },
        {
          name: "本月收藏订单",
          value: 210,
          icon: "star-on",
          color: "#ffb980",
        },
        {
          name: "本月未支付订单",
          value: 1234,
          icon: "s-goods",
          color: "#5ab1ef",
        },
      ]
    }
  },
  mounted() {
    getData().then((data)=>{
      console.log(data)
    })
  }
}
</script>
<style lang="less" scoped>
.user{
  display: flex;
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  .img{
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-right: 40px;
  }
  .user-info{
    .name{
        font-size: 32px;
        margin-bottom: 10px;
    }
    .access{
      color: #999999;
    }
  }
}
.login-info{
  p{
    line-height: 28px;
    font-size: 14px;
    color: #999999;
    span{
      color: #666666;
      margin-left: 60px;
    }
  }

}
.num{
  display: flex;
  flex-wrap: wrap;//自动换行
  .el-card{
    width: 32%;
    margin-bottom: 20px;
  }
  justify-content: space-between;
  .icon{
    width: 80px;
    height: 80px;
    font-size: 30px;
    color: white;
    text-align: center;
    line-height: 80px;
  }
  .detail{
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    .price{
      font-size: 30px;
      margin-bottom: 10px;
      line-height: 30px;
      height: 30px;
    }
    .dec{
      font-size: 14px;
      color: #999999;
      text-align: center;
    }
  }
}
</style>